class ResultUI extends egret.Sprite {

    public constructor() {
        super();
        this.once(egret.Event.ADDED_TO_STAGE, this.createView, this);
    }

    private createView(): void {
        //背景
        this.addChild(createBitmap("bgsec_png"));
        //雪花背景
        var snowflake_1 = createBitmap("one_snowflower_png", 0, 0);
        var snowflake_2 = createBitmap("one_snowflower_png", 0, -1206);
        this.addChild(snowflake_1);
        this.addChild(snowflake_2);
        egret.Tween.get(snowflake_1, { loop: true }).to({ y: 1206 }, 10000);
        egret.Tween.get(snowflake_2, { loop: true }).to({ y: 0 }, 10000);

        //操作说明背景
        var explain = div(0, 0, 750, 0, 750, 1206, 0, 1206, 0, 0, 0, 0);
        this.addChild(explain);
        var explainbg = createBitmap("1212_png", 16, 158);
        explain.addChild(explainbg);

        //操作说明文本
        var instructions = createTextFiled("操作说明", 275, 422, 48, 0xffffff);
        explain.addChild(instructions);
        var guize_first = createTextFiled("点击“开始”后，点击圣诞物可得分，碰到炸弹扣分；\n累计游戏得分满10000分即可参与抽奖，FUN享给好友亦可获现金豪礼！", 152, 527, 35, 0x3d9c30, "left", 455);
        guize_first.lineSpacing = 31;   //行间距
        explain.addChild(guize_first);
        var ps = createTextFiled("Ps：不限游戏次数", 155, 838, 30, 0x36acff);
        explain.addChild(ps);
        var star = createBitmap("start_btn_png", 275, 900);
        //添加开始按钮
        star.touchEnabled = true;
        explain.visible = true;
        star.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
            // explain.visible = false;
            SenceManage.create(this.stage).loadSence("preload", null, GameUI);
            egret.Tween.get(this).to({x:-640},500);
        }, this);
        explain.addChild(star);


        //左眼
        var eye1 = new egret.Shape();
        eye1.graphics.beginFill(0x000000);
        eye1.graphics.drawCircle(273, 298, 5);
        egret.Tween.get(eye1, { loop: true }).to({ x: 0 }, 1000).to({ x: 8 }, 1000).to({ x: 0 }, 1000);
        eye1.graphics.endFill();
        explain.addChild(eye1);
        //有眼
        var eye2 = new egret.Shape();
        eye2.graphics.beginFill(0x000000);
        eye2.graphics.drawCircle(345, 298, 5);
        egret.Tween.get(eye2, { loop: true }).to({ x: 0 }, 1000).to({ x: 8 }, 1000).to({ x: 0 }, 1000);
        eye2.graphics.endFill();
        explain.addChild(eye2);

    }

}
